<?php

namespace App\Http\Controllers\platform;

use App\Http\Controllers\Controller;
use App\Models\Document;
use Illuminate\Http\Request;

class FileController extends Controller
{

    public function store(Request $Request)
    {
        if(!$Request->name){
            return response()->json(['code' => '403', 'msg' => '请选择文件']);
        }
        if(!$Request->fid){
            return response()->json(['code' => '403', 'msg' => '请选择分类']);
        }
            
        $data = new Document();
        $data->name = $Request->name;
        $data->path = $Request->path;
        $data->size = $Request->size;
        $data->fid = $Request->fid;
        $data->type = $Request->type;
        $data->eid = $Request->eid;
        $data->create_time = time();
        $data->update_time = time();
        $data->save();
        return response()->json(['code' => '200', 'msg' => 'success','data'=>$data]);
    }
}
